package com.deyinet.bdcms.core.bean;

/**
 * Created by Administrator on 2017/3/28 0028.
 */
public class ApiResult<T> extends Result {
    protected T data;

    public T getData() {
        return this.data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public static <T> ApiResult<T> success(T data) {
        return new ApiResult(200, data);
    }

    public static ApiResult error(String msg) {
        return new ApiResult(300, msg);
    }

    public static ApiResult timeout() {
        return new ApiResult(301, "未登录");
    }

    public ApiResult() {
    }

    public ApiResult(int statusCode, String message) {
        super(statusCode, message);
    }

    public ApiResult(int statusCode, T data) {
        this.statusCode = statusCode;
        this.data = data;
    }
}
